<?php

/*
|--------------------------------------------------------------------------
| Admin Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of the routes that are handled
| by your application. Just tell Laravel the URIs it should respond
| to using a Closure or controller method. Build something great!
|
*/

Route::get('login', 'Auth\LoginController@showLoginForm');
Route::post('login', 'Auth\LoginController@login');
Route::get('logout', 'Auth\LoginController@logout');

Route::group(['middleware' => ['web', 'auth:admin']], function () {
    Route::get('dashboard', ['as' => 'dashboard.index', 'uses' => 'DashboardController@index']);

    // 用户
    Route::get('user/list', 'UserController@lists');
    Route::resource('user', 'UserController');

    // 剧本
    Route::get('play/list', 'Play\PlayController@lists');
    Route::resource('play', 'Play\PlayController', ['except' => 'show']);

    // 剧本分类
    Route::get('playCategory/list', 'Play\CategoryController@lists');
    Route::resource('playCategory', 'Play\CategoryController', ['except' => 'show']);

    // 剧本类型
    Route::get('playType/list', 'Play\TypeController@lists');
    Route::resource('playType', 'Play\TypeController', ['except' => 'show']);
});

Menu::make('AdminNavigation', function ($menu) {
    $menu->raw('', ['class' => 'header']);

    $menu->add('<span>仪表盘</span>', ['route' => 'admin::dashboard.index'])
        ->prepend('<i class="fa fa-th"></i>')
        ->append('<span class="pull-right-container"></span>');

    $menu->add('<span>用户管理</span>', '#', ['class' => 'treeview'])->id('userManager')
        ->prepend('<i class="fa fa-dashboard"></i>')
        ->append('<span class="pull-right-container"><i class="fa fa-angle-left pull-right"></i></span>');

    $menu->add('<i class="fa fa-circle-o"></i>用户列表', ['route' => 'admin::user.index', 'parent' => 'userManager']);

    $menu->add('<span>剧本管理</span>', '#', ['class' => 'treeview'])->id('playManager')
        ->prepend('<i class="fa fa-dashboard"></i>')
        ->append('<span class="pull-right-container"><i class="fa fa-angle-left pull-right"></i></span>');

    $menu->add('<i class="fa fa-circle-o"></i>剧本列表', ['route' => 'admin::play.index', 'parent' => 'playManager']);
    $menu->add('<i class="fa fa-circle-o"></i>剧本分类', ['route' => 'admin::playCategory.index', 'parent' => 'playManager']);
    $menu->add('<i class="fa fa-circle-o"></i>剧本类型', ['route' => 'admin::playType.index', 'parent' => 'playManager']);
});
